import { createApp } from 'vue'
// import { createPinia } from 'pinia'

import { createPinia } from './pinia'

import App from './App.vue'

const app = createApp(App)
const pinia = createPinia();
pinia.use(function ({ store, pinia, app, storeId }) {
  console.log('plugin', store, pinia, app, storeId);
  const local = localStorage.getItem('State');
  if (local) {
    store.$state = JSON.parse(local);
  }
  store.$subscribe((mutation, state) => {
    localStorage.setItem('State', JSON.stringify(state))
    console.log(">>>>", state)
  })
})
app.use(pinia)

app.mount('#app')
